package com.linzm.creationaltype.factory01.enums;

import com.linzm.creationaltype.factory01.Shape.Circle;
import com.linzm.creationaltype.factory01.Shape.Hexagon;
import com.linzm.creationaltype.factory01.Shape.Rectangle;
import com.linzm.creationaltype.factory01.Shape.Square;

/**
 * @Author zimingl
 * @Date 2023/4/15 12:32
 * @Description: 图形类型枚举
 */
public enum ShapeTypeEnum implements ShapeTypeInterface {
    CIRCLE("circle", "圆形", Circle.class),
    RECTANGLE("rectangle", "矩形", Rectangle.class),
    SQUARE("square", "正方形", Square.class),
    HEXAGON("hexagon", "六边形", Hexagon.class);

    ShapeTypeEnum(String type, String desc, Class<?> clazz) {
        this.type = type;
        this.desc = desc;
        this.clazz = clazz;
    }

    private final String type;

    private final String desc;

    private final Class<?> clazz;

    @Override
    public Class<?> getClazz() {
        return clazz;
    }

    @Override
    public ShapeTypeInterface getEnum(String type) {
        return ShapeTypeEnum.valueOf(type);
    }
}
